package mason.dp.strategy;

import java.util.ArrayList;
import java.util.Set;

/**
 * 封装按照月模式取文件路径的算法，某用户一月内每周所问题目路径放入一个set中，一月共有4个set，将4个set放入list中返回
 * @author MasonAir
 *
 */
public class MonthStrategy implements Strategy {

	@Override
	public ArrayList<Set<String>> getFilePathList(String username) {
		ArrayList<Set<String>> list = new ArrayList<Set<String>>();
		for (int i = -4; i <0; i++) {
			StringBuilder sqlQueryStr = new StringBuilder();
			sqlQueryStr.append("SELECT FilePath FROM [");
			sqlQueryStr.append(username);
			sqlQueryStr.append("] WHERE (ReceiveDate BETWEEN DATEADD([week], ");
			sqlQueryStr.append(i);
			sqlQueryStr.append(", GETDATE()) AND DATEADD([week], ");
			sqlQueryStr.append(i + 1); 
			sqlQueryStr.append(", GETDATE()));");
			list.add(DoSomeSQLQuery.queryStr(sqlQueryStr.toString()));
		}
		
		return list;
	}

}
